home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 7494 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: news.res.com!usenet
  2. From: crunch@res.com
  3. Newsgroups: comp.lang.c++,comp.os.msdos.programmer
  4. Subject: Re: Timer (0x1C) Interrupt exactly 18.2 seconds?
  5. Date: 23 Feb 1996 16:47:51 GMT
  6. Organization: RES Online
  7. Message-ID: <4gkr3n$e30@clare.res.com>
  8. References: <4givrv$cim@midland.co.nz>
  9. NNTP-Posting-Host: di024.res.com
  10. X-Newsreader: WinVN 0.92.6+
  11.  
  12. In article <4givrv$cim@midland.co.nz>, lowefam@igrin.co.nz (Jarrod S Lowe) says:
  13. >
  14. >Hi
  15. >
  16. >I have a C++ Program (on DOS) in which a function is attached to the
  17. >Timer (0x1C) Interrupt.
  18. >
  19. >The function has a static int to count the number of times it has been
  20. >called. Every 'x' calls, It executes another function.
  21. >
  22. >'x' is 546, which one would expect to result in the function being
  23. >called every 30 seconds. However, it is called every 29 point
  24. >something seconds. Over 5 minutes you can see it has drifted. If I had
  25. >one to 'x' (now 547) it is called every 30 point something seconds -
  26. >the same problem in reverse.
  27. >
  28. >This program is expected to run, continually, for YEARS - so a drift
  29. >that shows up in 5 minutes will make it unusable.
  30. >
  31. >Does anybody have any ideas WHY this is happening?
  32. >
  33. >Thanks
  34. >Jarrod S Lowe
  35. >(lowefam@igrin.co.nz)
  36. >
  37. If interrupts are enabled, the hardware timer interrupt is given highest
  38. priority.  It in turn calls the software interrupt 1ch, which includes
  39. the code in your program.  This interrupt gets called approximately
  40. 18.2065 times per second.  Even this number is not exact.
  41.